﻿using BCDto.Common.Wallet;
using BCService.Common.Wallet;
using Microsoft.AspNetCore.Mvc;

namespace BCTMSRESTful.Controllers.ClientApp.Wallet
{
    /// <summary>
    /// 用户钱包提现
    /// </summary>
    [ApiExplorerSettings(GroupName = "ClientApp")]
    [Route("api/v1/ClientApp/[controller]")]
    public class WalletTransferController : ClientAppBaseController
    {
        private readonly IWalletTransferService _walletTransferService;

        public WalletTransferController(IWalletTransferService walletTransferService)
        {
            _walletTransferService = walletTransferService;
        }

        /// <summary>
        /// 创建提现申请
        /// </summary>
        /// <param name="requestDto"></param>
        /// <response code="200">返回用户提现信息</response>
        /// <returns></returns>
        [HttpPost]
        [ProducesResponseType(typeof(WalletTransferDto), 200)]
        public IActionResult Post([FromBody]WalletTransferRequestDto requestDto)
        {
            var walletTransferDto = _walletTransferService.Create(requestDto, this.UserInfo);
            return Ok(walletTransferDto);
        }

        ///// <summary>
        ///// 用户提现记录
        ///// </summary>
        ///// <response code="200">返回用户提现信息</response>
        ///// <returns></returns>
        //[HttpGet("[action]")]
        //[ProducesResponseType(typeof(PageableList<WalletTransferDto>), 200)]
        //public IActionResult UserWalletTransfer([FromQuery(Name = "index")]int index = 1, [FromQuery(Name = "size")]int size = 10)
        //{
        //    index = index == 0 ? 0 : (index - 1) * size;
        //    var data = _walletTransferService.GetUserWalletTransfer(User.UserId, index, size);
        //    return Ok(data);
        //}
    }
}